Column

Chart A

Column

---
title: "Scarcity and demand continues in 2021's housing market"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    source_code: embed
---

```{r setup, include=FALSE,}
# rmarkdown::render(input = 'flexdashboard.Rmd', output_format = 'all',output_dir = './doc', output_file = 'index.html')
library(flexdashboard)
source('./src/eda.r')
```

Column {data-width=600}
-----------------------------------------------------------------------

### Chart A

```{r}
library(leaflet)
library(maps)
mapStates = map("state", fill = TRUE, plot = FALSE)

leaflet(data = mapStates) %>% addTiles() %>%
  addPolygons(fillColor = topo.colors(10, alpha = NULL), stroke = FALSE)
```

Column {data-width=350}
-----------------------------------------------------------------------

### 

```{r}
inventory_result = ggplot(zillow %>% filter(StateName == "US")) + 
  geom_bar(aes(x = Date, y = Inventory_yoy), stat = 'identity', fill = 'orange') + 
  labs(title = 'Inventory drastically reduced since initial lockdown,
       with recent recovery from pandemic lows') +
  ylab('YoY Change')+
  scale_x_date(breaks = scales::pretty_breaks(n = 10)) +
  scale_y_continuous(labels = scales::percent) + 
  xlab('')+
  theme(panel.background = element_rect(fill = "white", colour = "white"))

ggplotly(inventory_result) %>% config(displayModeBar = F)
```

### 

```{r}
sales_result = ggplot(zillow %>% filter(StateName == "US")) + 
  geom_bar(aes(x = Date, y = SalesCount_yoy), stat = 'identity', fill = 'dodgerblue') + 
  labs(title = 'Sales suffered during nation-wide lockdowns 
       but quickly rebounded when lifted') +
  ylab('YoY Change')+
  scale_x_date(labels = scales::date_format("%b %y"),breaks = scales::pretty_breaks(n = 10)) +
  scale_y_continuous(labels = scales::percent) + 
  xlab('')+
  theme(panel.background = element_rect(fill = "white", colour = "white"))

ggplotly(sales_result) %>% config(displayModeBar = F)
```